#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/Animation.h"

using namespace fxcc::yml;
using CType = fxcc::graph::common::Animation;;

template<>
void Serializer::Encode<CType>(YAML::Node& node, const CType& inst)
{
    SetVariable<std::string>(node,  "m_Name", inst.m_Name);
    SetVariable<float>(node, "m_Duration", inst.m_Duration);
    SetVariable<float>(node, "m_TicksPerSecond", inst.m_TicksPerSecond);
    SetVariable<float>(node, "m_TotalTime", inst.m_TotalTime);
    SetMapVariable<fxcc::graph::common::Channel>(node, "m_Channels", inst.m_Channels);
}


template<>
bool Serializer::Decode<CType>(const YAML::Node& node, CType& inst)
{
    GetVariable<std::string>(node, "m_Name", inst.m_Name);
    GetVariable<float>(node, "m_Duration", inst.m_Duration);
    GetVariable<float>(node, "m_TicksPerSecond", inst.m_TicksPerSecond);
    GetVariable<float>(node, "m_TotalTime", inst.m_TotalTime);
    GetMapVariable<fxcc::graph::common::Channel>(node, "m_Channels", inst.m_Channels);

    return true;
}
